package com.tingyuge.thinking.spring.configuration.bean.definition;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author xiaodao
 * @version 1.0
 * @date 2021/6/27
 */
public class BeanGarbageCollectionDemo {
    public static void main(String[] args) throws InterruptedException {
        //创建beanFactory容器
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        applicationContext.register(BeanInitializationDemo.class);
        //启动应用上下文
        applicationContext.refresh();
        //关闭应用上下文
        System.out.println("spring 应用上下文准备关闭.....");
        applicationContext.close();

//        Thread.sleep(5000L);
        System.gc();
        Thread.sleep(5000L);
    }
}
